package com.kensure.shike.card.model;

import java.util.Date;

import co.kensure.frame.BaseInfo;
import co.kensure.mem.DateUtils;

/**
 * 用户优惠卷对象类
 * 
 * @author fankd created on 2019-6-28
 * @since
 */
public class CardUser extends BaseInfo {

	private static final long serialVersionUID = 3545276994084105527L;

	/***/
	private Long id;

	/** 标题 */
	private String title;

	/** 用户id */
	private Long userid;

	/** 优惠券起始时间 */
	private Date timeStart;

	/** 优惠券结束时间 */
	private Date timeExpire;

	/** 状态，1是可以使用，9是已经使用，-1是失效 */
	private Integer status;

	/** 满多少 */
	private Double man;

	/** 减多少 */
	private Double jian;

	public CardUser() {

	}

	public CardUser(CardDefine card, Long userid) {
		setTitle(card.getTitle());
		setUserid(userid);
		setStatus(1);
		setMan(card.getMan());
		setJian(card.getJian());
		Date now = new Date();
		setTimeStart(now);
		setTimeExpire(DateUtils.getPastDay(now, card.getDayExpire()));		
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public Long getUserid() {
		return userid;
	}

	public void setUserid(Long userid) {
		this.userid = userid;
	}

	public Date getTimeStart() {
		return timeStart;
	}

	public void setTimeStart(Date timeStart) {
		this.timeStart = timeStart;
	}

	public Date getTimeExpire() {
		return timeExpire;
	}

	public void setTimeExpire(Date timeExpire) {
		this.timeExpire = timeExpire;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Double getMan() {
		return man;
	}

	public void setMan(Double man) {
		this.man = man;
	}

	public Double getJian() {
		return jian;
	}

	public void setJian(Double jian) {
		this.jian = jian;
	}

	public String getTimeStartDay() {
		return DateUtils.format(timeStart,DateUtils.DAY_FORMAT);
	}
	
	public String getTimeExpireDay() {
		return DateUtils.format(timeExpire,DateUtils.DAY_FORMAT);
	}
}
